Xbasic

STRTRAN_SPECIAL Function

Syntax

Modified_String as C = strtran_special(C string ,C Start_string ,C End_string ,C replace_string [,N replace_count ])

Arguments

Modified_String

The modified version of Search_in_Text if replacements were made. Otherwise, the unmodified Search_in_Text.

string

The text to search for occurrences of the find text.

Start_string

The beginning characters of a find text of variable length.

End_string

The ending characters of a find text of variable length.

replace_string

The text that replaces the find text.

replace_count

Optional. Default = 0 (all occurrences). The number of occurrences to replace. Numeric

Description

Searches for occurrences of a sub-string starting with 'start_string' and ending with 'end_string' and replaces with 'replace_string'. Replace_count specifies how many replacements to make. Default is 0, which indicates replace all occurrences. Search is case-sensitive.

Discussion

The STRITRAN_SPECIAL() function replaces occurrences of a variable length find text, specified with a starting character string and an ending character string.

Example

s = 
border-left-width: 1px;
border-left-style: Solid;
padding-top: 5px;
border-top-width: 1px;
border-top-style: Solid;
padding-right: 5px;
border-right-width: 1px;
border-right-style: Solid;
padding-bottom: 5px;
border-bottom-width: 1px;
%a%
ss = strtran_special(s, "padding", "5px;", "")
? ss
= border-left-width: 1px;
border-left-style: Solid;
border-top-width: 1px;
border-top-style: Solid;
border-right-width: 1px;
border-right-style: Solid;
border-bottom-width: 1px;

Limitations

The Start_string and End_string arguments are case sensitive.

See Also